package com.hutao.medical.mapper;

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.ibatis.annotations.Param;

import com.hutao.medical.pojo.MedicalModify;
import com.hutao.medical.query.AuditQuery;
import com.hutao.medical.query.MedModifyVo;
import com.hutao.medical.query.MedRecordQuery;

public interface MedicalModifyMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(MedicalModify record);

    int insertSelective(MedicalModify record);

    MedicalModify selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(MedicalModify record);

    int updateByPrimaryKey(MedicalModify record);
    
    /**
     * 根据medical_function的id和medical_error的code查询medical——modify
     * @param medicalFunctionId
     * @param medicalErrorCode
     * @return
     */
    MedModifyVo getMedicalModifyByMedicalFunctionAndMedErrorCode(@Param("medicalFunctionId")Integer medicalFunctionId,@Param("medicalErrorCode")String medicalErrorCode);
    
    /**
     * 根据medical_function的id和medical_error的code查询是否存在medical_modify
     * @param medicalFunctionId
     * @param medicalErrorCode
     * @return
     */
    int isExistsMedicalModifyByFunctionAndErrorCode(@Param("medicalFunctionId")Integer medicalFunctionId,@Param("medicalErrorCode")String medicalErrorCode);
   
    /**
     *  获取medicalModify
     * @return
     */
    List<Map<String,Object>> getMedicalModifyList(MedRecordQuery medRecordQuery);
    
    /**
     * 获取审核错误信息
     * @param medicalFunctionId
     * @return
     */
    List<Map<String,Object>> getMedicalErrorList(@Param("medicalFunctionId")Integer medicalFunctionId,@Param("status")Integer status);
    
    /**
     * 获取medicalModify总数
     * @param auditQuery
     * @return
     */
    int getMedicalModifyListCount(MedRecordQuery medRecordQuery);
    
    
    List<Map<String,Object>> getMedicalErrorByFirstGuid(@Param("firstGuid")String firstGuid);
    
    /**
     * 查询返修firstGuidList
     * @param auditQuery
     * @return
     */
    List<String> getMedicalModifyFirstGuidList(AuditQuery auditQuery);
    
    List<Map<String, Object>> getMedicalAuditByFirstGuid(String firstGuid);
    
  	 //病案返修查询已经修改记录
  	 Map<String, Object> getMedicalAuditErrorUpdateList(AuditQuery auditQuery);
    
  	 long getMedicalAuditErrorUpdateCount(AuditQuery auditQuery);
  	 
  	 //查询已经修改过的病案
  	 List<Map<String, Object>> getMedicalModifyUpdatedList(AuditQuery auditQuery);
  	 
  	 //查询已经修改过的病案总记录数
  	 int getMedicalModifyUpdatedCount(AuditQuery auditQuery);
  	 
  	 
  	 
    
 
}